<template>
  <div class="related-report-box">
    <div class="title">相关报告</div>
    <div class="list-box">
      <div class="item" v-for="(item, index) of list.slice(0, 7)" :key="index" @click="toReportDetail(item.uuid)">
        <div class="name">{{item.name}}</div>
      </div>
    </div>
  </div>
</template>

<script>
import { relateReportList } from '@/api/api';

export default {
  data() {
    return {
      list: []
    }
  },
  mounted() {
    this.getData();
  },
  methods: {
    async getData() {
      const res = await relateReportList(this.$route.query.uuid);
      this.list = res.list || [];
    },
    toReportDetail(uuid) {
      // let routerJump = this.$router.resolve({ name: 'InstituteDetail', query: {uuid} });
      // window.open(routerJump.href, '_blank');
      this.$router.push({name: 'InstituteDetail', query: {uuid}});
    }
  }
}
</script>

<style lang="scss" scoped>
.related-report-box {
  margin-bottom: 52px;
  .title {
    width: 340px;
    height: 56px;
    line-height: 32px;
    background: #F9F9F9;
    border: 1px solid #F1F1F1;
    box-sizing: border-box;
    border-radius: 4px 4px 0px 0px;
    padding: 12px 20px;
  }
  .list-box {
    padding: 0 20px;
    background: #FFFFFF;
    .item {
      padding: 20px 0;
      border-bottom: 1px solid #F1F1F1;
      cursor: pointer;
      &:last-child {
        border-bottom: none;
        border-radius: 0px 0px 4px 4px;
      }
      &:hover {
        .name {
          color: #D42A31;
        }
      }
      .name {
        max-height: 40px;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
        font-size: 14px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: #272727;
        line-height: 20px;
        word-break: break-all;
      }
    }
  }
}
</style>